package com.qf.listener;


import com.qf.pojo.TbGoods;

import com.qf.service.GoodsService;

import com.qf.service.impl.GoodsServiceImpl;


import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.util.List;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/8/17 10:36
 */
@WebListener
public class GoodsContextListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
//        GoodsService goodsService=new GoodsServiceImpl();
//        List<TbGoods> goodsList=goodsService.find();
//        ServletContext servletContext = servletContextEvent.getServletContext();
//        System.out.println("goodsList = " + goodsList);
//        servletContext.setAttribute("goodsList", goodsList);

    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        servletContextEvent.getServletContext().removeAttribute("goodsType");
    }
}
